package Testdemo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:周次煜
 * Date: 2024-04-23
 * Time：12:16
 */


class Plate <T>{
   private T s;

    public T getS() {
        return s;
    }

    public void setS(T s) {
        this.s = s;
    }
}

class Fruit {

}

class Apple extends Fruit{

}

class Banana extends Fruit{

}
public class Test2 {
    public static void main(String[] args) {
        Plate<Fruit> plate1=new Plate<>();
        Plate<Apple> plate2=new Plate<>();
        Plate<Banana> plate3=new Plate<>();


        func(plate1);
        func(plate2);
        func(plate3);
    }

    /**
     *
     * 泛型只有上界，没有下界
     * 通配符 ？ 的上界
     * @param plate 植物
     *
     */
    public  static  void func(Plate<?extends Fruit> plate) {
//        System.out.println(plate.getS());
    }
}
